package com.zggk.lzz.bridgemx;

import android.app.Activity;

import com.alibaba.fastjson.JSON;
import com.zggk.lzz.api.MyApplication;
import com.zggk.lzz.api.Urls;
import com.zggk.lzz.bridgetmx.BridgeMxBean;
import com.zggk.lzz.callback.StringDialogCallback;
import com.zggk.lzz.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class BridgeMxPresenter extends BasePresenterImpl<BridgeMxContract.View> implements BridgeMxContract.Presenter {
    @Override
    public void getData(String id, Activity activity) {
        OkGo.<String>post(Urls.JAVASERVER5 + "proj/apiserver/apisno/ncglFindBridgeMessage")
                .params("token", "Bearer$" + MyApplication.spUtils.getString("Token", ""))
                .params("bridgeId", id)
                .execute(new StringDialogCallback(activity) {
                    @Override
                    public void onSuccess(Response<String> response) {
                        BridgeMxBean bridgeMxBean = JSON.parseObject(response.body(),BridgeMxBean.class);
                        if (mView == null)
                            return;
                        mView.getDatas(bridgeMxBean);
                    }
                });
    }
}
